<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/main.js"></script>
</head>
<body>
<div class="main">
    <div class="header">
        <div class="headerL">
            <img src="images/u7.png">
            <div class="name">
                <p class="name1">
                    山东大学附属儿童医院
                </p>
                <p class="des">
                    Childern’s Hospital Affiliated to Shandong Universitry
                </p>
            </div>
        </div>
        <div class="headerR">
            <span id="kyear"></span>
            <span id="ktime"></span>
        </div>
    </div>
    <div class="con">
        <div class="title">
            <a id="goIndex">返回首页</a> 报告查询结果
            <span id="timeOut"></span>
        </div>
        <div class="person">
            <p>
                <span id="username">就诊人 : </span>
                <span id="useridcard">证件号 : </span>
            </p>
            <div class="sco">

                <table cellspacing="0">
                    <thead>
                    <tr style="background: rgba(242, 242, 242, 0.486274509803922)">
                        <th>
                            项目名称
                        </th>
                        <th>
                            单位名称
                        </th>
                        <th>
                            金额
                        </th>
                        <th>
                            种类
                        </th>
                        <th>
                            出报告时间
                        </th>
                        <th>
                        </th>
                    </tr>
                    </thead>
                    <tbody id="fapiaoId">

                    </tbody>
                </table>
                <div style="width: 100%;text-align: center;display: none" class="emptyTag">
                    <img src="images/empty.png"
                         style="width: 150px;margin-top: 45px">
                    <div style="color:black;font-size: 16pt">暂无打印数据</div>
                </div>

            </div>
            <div class="page">
                <span>
                    <a>
                        上一页
                    </a>
                    <a>
                        下一页
                    </a>
                </span>
                <a class="dayin">
                    打印报告
                </a>
            </div>
            <div class="window" style="display: none">
                <div class="success">
                    <h2>
                        错误提示
                    </h2>
                    <p>
                        请选择要打印的数据！
                    </p>
                    <a class="goIndex">
                        <img src="images/pcg.png">
                    </a>
                </div>
            </div>

        </div>

    </div>
    <div class="footer">
        <img src="images/u29.svg">
        0531-87964999
    </div>
</div>
<script>
    window.addEventListener('pageshow', function(e) {
        //如果检测到页面是从“往返缓存”中读取的，刷新页面
        if (e.persisted) {
            window.location.reload();
        }
    });
    $(function () {
        $.ajax({
            url: domain + "/web/api/machine/getUserQr",
            type: "post",
            dataType: "json",
            data: {'qrCode': localStorage.getItem('idcardOld'), 'type': 'baogao'},
            success: function (data, textStatus, jqxhr) {
                console.log("__成功__");
                console.log(textStatus);
                console.log(jqxhr);
                console.log("______");
                if (data.result && data.result.uwiList) {
                    console.log(data.result.uwiList);
                    localStorage.setItem("username", data.result.name)
                    localStorage.setItem("useridcard", data.result.idcard)
                    localStorage.setItem("baogaoDataInfo",undefined)
                    localStorage.setItem("baogaoData", JSON.stringify(data.result.userWaterRecord))
                }else{
                    localStorage.setItem("username",undefined)
                    localStorage.setItem("useridcard", undefined)
                    localStorage.setItem("baogaoDataInfo",undefined)
                    localStorage.setItem("baogaoData", undefined)
                }
                baogaoInit();
            },
            error: function (jqxhr, textStatus, error) {
                alert('请求失败！')
            }
        })
        daojishi()
        $(document).on('click', '.dayin', function () {
                var data = $('input:radio:checked').val();
                if (data === undefined) {
                    $(".window").show()
                    setTimeout(function () {
                        $(".window").hide();
                        window.location.href = 'index.html';
                    }, 5000)
                } else {
                    var fapiaoData = localStorage.getItem('baogaoData')
                    if (fapiaoData) {
                        const fapiaoJSON = JSON.parse(fapiaoData)
                        localStorage.setItem('baogaoDataInfo', JSON.stringify(fapiaoJSON[data]))
                        window.location.href = 'printBaoGao.html'
                    }
                }
                // window.location.href = '2.html'
            }
        )
    })

</script>
</body>
</html>
